<script type="text/javascript">
    function slideOption(selector){
        $(selector+'.closed').slideDown('slow',function(){
            $(selector).removeClass('closed');
            $(selector).addClass('opened');
        });
        $(selector+'.opened').slideUp('slow',function(){
            $(selector).removeClass('opened');
            $(selector).addClass('closed');
        });
    }
</script>
<div id="option">
    <div id="option-wrap">
        <?php if ($this->session->flashdata('option_status')) : ?>
            <div id="submitOk">
                <span>
                    <?php echo $this->session->flashdata('option_status'); ?>
                </span>
            </div>
        <?php endif; ?>
        <div id="category-option" class="option-item">
            <div id="co-title" class="option-menu" onclick="slideOption('#co-content')">
                <h2>
                    Category
                </h2>
            </div>
            <div id="co-content" class="option-content closed">
                <div id="coc-wrapper">
                    <div>
                        <table id="list-cat">
                            <tr>
                                <th>Category Title</th>
                                <th>Action</th>
                            </tr>
                            <?php
                            $count = 0;
                            foreach ($cat->result() as $value) :
                                echo (($count % 2) == 0) ? '<tr class="alt">' : '<tr>';
                                ?>
                                <td><?php echo $value->category_title; ?></td>
                                <td>
                                    <a href="<?php echo base_url() . 'option/edit_cat/' . $value->category_id; ?>">
                                        <button>Edit</button>
                                    </a>
                                    <a href="<?php echo base_url() . 'option/delete_cat/' . $value->category_id; ?>">
                                        <button>Delete</button>
                                    </a>
                                </td>
                                </tr>
                                <?php
                                $count++;
                            endforeach;
                            ?>
                        </table>
                    </div>
                    <div>
                        <form action="<?php echo base_url(); ?>option/add_cat" method="post">
                            <div class="formField">
                                <div class="formLabel">
                                    <label for="newCat">
                                        <span>Add Category</span>
                                    </label>
                                </div>
                                <input class="text" id="newCat" name="newCat" type="text" />
                            </div>
                            <div class="formSubmit">
                                <input class="submit" value="Add" type="submit" />
                            </div>
                            <div class="uic"> 
                                <br> 
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div id="user-option" class="option-item">
            <div id="uo-title" class="option-menu" onclick="slideOption('#uo-content')">
                <h2>
                    Account
                </h2>
            </div>
            <div id="uo-content" class="option-content closed">
                <div class="uo-item">
                    Email&nbsp;
                    <br/><?php echo $user->user_email;?>
                </div>
                <div class="uo-item">
                    Name&nbsp;<?php echo anchor('option/edit_name','Change');?>
                    <br/><?php echo $user->user_name;?>
                </div>
                <div class="uo-item">
                    Password&nbsp;<?php echo anchor('option/edit_password','Change');?>
                </div>
            </div>
        </div>
    </div>
</div>